CREATE TABLE [Clients] (
  [Id] bigint IDENTITY (1,1) NOT NULL
, [Name] nvarchar(100) NOT NULL
, [Address] nvarchar(500) NOT NULL
, [PostalCode] nvarchar(50) NULL
, [City] nvarchar(50) NULL
, [State] nvarchar(50) NULL
, [Country] nvarchar(50) NOT NULL
, [Phone] nvarchar(50) NULL
, [Email] nvarchar(50) NULL
, [IsMaster] bit NOT NULL
, [Signature] image NULL
);
GO
ALTER TABLE [Clients] ADD CONSTRAINT [PK__Clients] PRIMARY KEY ([Id]);
GO

CREATE TABLE [Users] (
  [Id] bigint IDENTITY (1,1) NOT NULL
, [UserName] nvarchar(100) NOT NULL
, [Password] nvarchar(200) NOT NULL
, [Rights] bigint NOT NULL
, [DisplayName] nvarchar(200) NULL
);
GO
ALTER TABLE [Users] ADD CONSTRAINT [PK_Users] PRIMARY KEY ([Id]);
GO

SET IDENTITY_INSERT [Users] ON;
GO
INSERT INTO [Users] ([Id],[UserName],[Password],[Rights],[DisplayName]) VALUES (1,N'admin',N'{SHA-512}XkpJZWnPvSNQyxpE/x2LrnC6rqr1ToOsMe0/liQse3dQDH71+lZs8b+0+YKpyWIfog2tp8LFCgk0RwfznV/eCA==',1048063,N'Administrator');
GO
SET IDENTITY_INSERT [Users] OFF;
GO

CREATE TABLE [Invoices] (
  [Id] bigint IDENTITY (1,1) NOT NULL
, [Number] nvarchar(50) NULL
, [Date] datetime NULL
, [ClientId] int NULL
, [SellerId] int NULL
);
GO
ALTER TABLE [Invoices] ADD CONSTRAINT [PK__Invoices] PRIMARY KEY ([Id]);
GO

CREATE TABLE [InvoiceDetail] (
  [Id] bigint IDENTITY (1,1) NOT NULL
, [InvoiceId] bigint NOT NULL
, [Description] nvarchar(200) NOT NULL
, [Price] money NOT NULL
, [Units] int NOT NULL
);
GO
ALTER TABLE [InvoiceDetail] ADD CONSTRAINT [PK__InvoiceDetail] PRIMARY KEY ([Id]);
GO

